/*
 * ============================================================================
 * Copyright Notice!
 * ----------------------------------------------------------------------------
 * This file contains proprietary and confidential information belonging to the
 * group of people involvled in developing this project.  Reproduction, disclosure 
 * or use without specific written authorization from project stake holders is 
 * prohibited. Please refer the readme.txt in project installation folder for more
 * specific contacts
 *
 * All rights reserved.
 * ============================================================================
 */
package edu.uwm.universitydb.dao.project.member;

import java.sql.PreparedStatement;
import java.sql.SQLException;

import edu.uwm.universitydb.framework.nontransactional.db.command.impl.NonTransactionalDataManipulationCommandBase;

/**
 * <code>InsertProjectMemberCommand</type>
 * 
 * @author Shyam Nair
 */
public class InsertProjectMemberCommand extends NonTransactionalDataManipulationCommandBase
{

    /** string holding the insert command */
    private static final String SQL =
        "insert into university.supervises (prof_ssn, grad_ssn, pno) values ((select prof_ssn from university.manage where pno = ?), ? , ?);";

    /** attribute holding student ssn */
    private final String mStudentSSN;

    /** attribute holding project number */
    private final String mProjNum;

    /**
     * 
     * @param ssn
     * @param projNum
     */
    public InsertProjectMemberCommand(final String ssn, final String projNum)
    {
        mStudentSSN = ssn;
        mProjNum = projNum;
    }

    /*
     * (non-javadoc)
     * @see edu.uwm.universitydb.framework.db.command.DBCommand#getSQL()
     */
    @Override
    public String getSQL()
    {
        return SQL;
    }

    /*
     * (non-javadoc)
     * @see edu.uwm.universitydb.framework.db.command.DBCommand#setParameters(java.sql.PreparedStatement)
     */
    @Override
    public void setParameters(final PreparedStatement pStmt) throws SQLException
    {
        pStmt.setString(1, mProjNum);
        pStmt.setString(2, mStudentSSN);
        pStmt.setString(3, mProjNum);
    }

}

/*
 * ============================================================================
 * Change History
 * ----------------------------------------------------------------------------
 * Apr 23, 2014   Shyam Nair
 * File created
 * ----------------------------------------------------------------------------
 */